<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>注册</title>

<!-- java script验证密码是否一致 -->
<script type="text/javascript">
	function checkPassword() {

		var psd1 = document.getElementById("password");
		var psd2 = document.getElementById("repassword");
		
		if (psd1.value != psd2.value) {
			alert("两次密码不一致");
			return false;
		} else {
			return true;
		}

	}
</script>


</head>

<body>

	<%
		//错误信息输出

		String errMsg = (String) session.getAttribute("err");
		if (errMsg != null) {
	%>
	<div style="color:red;"><%=errMsg%></div>
	<%
		session.removeAttribute("err");
		}
	%>

	<form onsubmit="return checkPassword()" action="servlet/RegServlet" method="post">

		<table border=0>
			<caption>
				<h3>用户注册</h3>
			</caption>
			<tr>
				<th align="right">用户名:</th>
				<th align="left"><input type="text" name="username"></th>
			</tr>

			<tr>
				<th align="right">密码：</th>
				<th align="left"><input type="password" id="password" name="password"
					maxlength=6></th>
			</tr>

			<tr>
				<th align="right">确认密码：</th>
				<th align="left"><input type="password" id="repassword"
					maxlength=6></th>
			</tr>

			<tr>
				<th align="right"><input type="submit" value="注册"></th>
				<th align="left"><input type="reset" value="重置"></th>
			</tr>

		</table>

	</form>

</body>
</html>
